<template>
  <div class="__bak" :style="{ 'background-color': cptBgColor }" @click.stop="handleClick">
    <van-icon name="arrow-left" />
    <span :style="{ 'margin-left': '10px', color: cptTextColor }">返回</span>
  </div>
</template>

<script>
export default {
  name: 'CommonBack',
  props: {
    theme: {
      type: Object, // {bgColor: '', textColor: ''}
      required: false,
      default: function () {
        return { bgColor: '', textColor: '' }
      }
    }
  },
  data() {
    return {
      bgColor: this.theme.bgColor || 'rgba(245, 245, 245, 0.5)',
      textColor: this.theme.textColor || '#666666',
    };
  },
  mounted() {
  },
  computed: {
    cptTextColor() {
      return this.textColor;
    },
    cptBgColor() {
      return this.bgColor;
    }
  },
  methods: {
    handleClick() {
      this.$emit('clicked', 'click');
    },
  }
};
</script>

<style lang="scss" scoped>
.__bak {
  width: 74px;
  height: 28px;
  float: right;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 8px;
  background-color: rgba(245, 245, 245, 0.5);
}
</style>